<?php
if(!defined('IN_IBEIKE')) {
	exit('Access Denied');
}

class table_user_check_copy1 extends common_table
{
	public function __construct() {

		$this->_table = 'user_check_copy1';
		$this->_pk    = 'cid';

		parent::__construct();
	}
	public function fetch_all_by_cid($cid){
		if(!empty($cid)&&$cid){
			return DB::fetch_first('SELECT * FROM %t WHERE cid=%s',array($this->_table,$cid));//返回数组包含各个字段的值
		}
		return false;
	}
	public function fetch_all_by_uid($uid){
		if(!empty($uid)&&$uid){
			$result=DB::fetch_first('SELECT * FROM %t WHERE uid=%s',array($this->_table,$uid));//返回数组包含各个字段的值
			if($result['ischeck']==1){
				return 1;
			}else{
				return 0;
			}
		}
		return false;
	}
	public function delete_all_by_cid($cid,$limit="",$unbuffered = true){//按主键删除
		if(!empty($cid)&&$cid){
			$condition=$this->_pk."='".$cid."'";
			return DB::delete($this->_table,$condition,limit,$unbuffered = true);//返回受影响的行数
		}
		return false;
	}
	public function update_by_cid($cid,$data,$unbuffered = false, $low_priority = false){
		if(!empty($cid) && !empty($data)){
			$condition=$this->_pk."='".$cid."'";
			return DB::update($this->_table,$data,$condition,$unbuffered,$low_priority);//返回前一次 MySQL 操作所影响的记录行数
		}
		return false;
	}
	public function insert($data, $return_insert_id = false, $replace = false, $silent = false){
		if(!empty($data)){
			return DB::insert($this->_table,$data, $return_insert_id,$replace,$silent);//返回上一步 INSERT 操作产生的 ID
		}
		return false;
	
	}
	public function check_on($uid){
		if(!empty($uid)){
			$condition="uid=".$uid;
			$data=array();
			$data['ischeck']=1;
			$data['checktime']=time();
			return DB::update($this->_table,$data,$condition,$unbuffered,$low_priority);
		}else{
			return false;
		}
	}
	

	
}
?>